home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!news
- From: bellew@ix.netcom.com (Leo Bellew)
- Newsgroups: comp.lang.eiffel,comp.lang.c,comp.lang.c++,comp.object,comp.software-eng
- Subject: Re: Portability of code & skills (Beware of "C" Hackers etc)
- Date: Thu, 28 Mar 1996 05:08:56 GMT
- Organization: Netcom
- Message-ID: <3159f68e.43678384@nntp.ix.netcom.com>
- References: <31494D29.4D4B@dmu.ac.uk> <DoG3HE.48E@assip.csasyd.oz> <31517E6F.5930@dmu.ac.uk> <DooBwC.8C0@world.std.com> <65O34-3-3RB@herold.franken.de> <4j8177$18ma@saba.info.ucla.edu>
- Reply-To: bellew@ix.netcom.com
- NNTP-Posting-Host: phi-pa6-10.ix.netcom.com
- X-NETCOM-Date: Wed Mar 27 11:14:34 PM CST 1996
- X-Newsreader: Forte Agent .99d/32.182
-
- Now, now. COBOL uses *all* global variables, and it has never been
- accused of being an ivory tower idea from CS, which you seemed to be
- implying. In Pascal, the use of global variables is not a side-effect
- but rather a central-effect. It is in no way an afterthought or a
- hidden or unanticipated effect. Whether it is good practice or not,
- that is a question I have given up on answering many years ago. You
- have a lot of company in considering global variable harmful, though.
-
- Leo
-
- On 26 Mar 1996 06:01:11 GMT, jmartin@cs.ucla.edu (Jay Martin) wrote:
-
- >jhd@herold.franken.de (Joachim Durchholz) writes:
- >
- >>tej@world.std.com wrote 22.03.96 on Re: Portability of code & skills (Beware of "C" Hackers etc):
- >
- >>> I don't remember enough Pascal to know what you mean. I know you could
- >>> define a function inside a function, making Pascal block-structured.
- >>> C can't do that, but of course you can pass functions as arguments of
- >>> functions.
- >
- >>The power of this mechanism is that the local function can access local
- >>variables of its surrounding function. E.g. in a list processing
- >>environment you could write
- >
- >> function CountThem (l: List): integer;
- >> var Count: integer
- >> procedure CountOne (e: ListElement);
- >> begin
- >> if <some condition on e fulfilled> then begin
- >> Count := Count + 1;
- >> end;
- >> end;
- >> begin
- >> ApplyOnList (l, CountOne); (* !!!! *)
- >> CountThem := Count
- >> end;
- >
- >
- >This is what I call side-effects on a global variable (or variable of
- >a larger scope). Its not what I call good programming practice. In
- >fact, I see nested procedures as implemented in algol block languages
- >(automatic importation of variables from larger scopes) as another
- >stupid idea of CS.
- >
- >Jay
- >
- >
- >
- >
- >
-
-